home *** CD-ROM | disk | FTP | other *** search
- Path: rose_ip171.efn.org!peterf
- From: peterf@gears.efn.org (Peter F.)
- Newsgroups: comp.lang.c++
- Subject: BGI Driver. Reply
- Date: Fri, 12 Jan 1996 16:51:38
- Organization: Southern Oregon Unified Networking District (SOUND)
- Message-ID: <peterf.74.0010DCCD@gears.efn.org>
- NNTP-Posting-Host: rose_ip171.efn.org
- X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]
-
- Dear Wong,
-
- Here is some code I wrote myself, in order to use the .bgi driver. Remember
- the driver must be in your compilers bgi directory. (ex. C:\borlandc\bgi )
-
- Your Friend,
-
- Peter Felten
- peterf@gears.efn.org
-
- #include <iostream.h>
- #include <graphics.h>
- #include <conio.h>
- #include <stdio.h>
- #include <process.h>
-
- int huge DetectVGA256(void);
- void checkgerrors(void);
-
- int main(void)
- {
- int i, gdriver, gmode, y, wthx, hthy;
- gdriver=installuserdriver("VGA256" , DetectVGA256);
- gdriver=DETECT;
- checkgerrors();
- initgraph(&gdriver,&gmode,"\\borlandc\\bgi");
- checkgerrors();
-
- for (i=1; i<64; i++)
- /* Mixing colors rd. gr. bl. to make different shades of color */
- setrgbpalette(i, 60, i, 12);
-
- hthy = getmaxy() / 40;
- wthx = getmaxx();
- y = 0;
- for (i=0; i<64; i++)
- {
- setfillstyle(SOLID_FILL, i);
- bar(0, y, wthx, y+hthy);
- y += hthy;
- }
-
- getch();
- closegraph();
- return 0;
- }
-
- int huge DetectVGA256(void)
- {
- return 0;
- }
-
- void checkgerrors(void)
- {
- int gerror;
- gerror = graphresult();
- if (gerror != grOk)
- {
- cerr << "Graphics error: " << grapherrormsg(gerror) << endl;
- cerr << "Press any key to halt: ";
- getch();
- exit(1);
- }
- }
-
-
-
-